<pre><?
//You need to have all skills locally stored for this to properly work
define('GWBBCODE_ROOT', '..');
require_once(GWBBCODE_ROOT.'/gwbbcode.inc.php');

//Load skill database
$skills = require(SKILLS_PATH_1);  //Can't use array_merge here otherwise keys get lost
$add_list = require(SKILLS_PATH_2);
foreach ($add_list as $key => $val) {
   $skills[$key] = $val;
}

$pvx_skills = Array();
foreach ($skills as $id => $skill) {
   if (strpos($skill['name'], '(PvP)') !== false) {
      $pvx_skills[$id] = $skill;
   }
}

//Output PvX skills
$cur_prof = false;
$cur_attr = false;
$first_prof = true;
foreach($pvx_skills as $id => $skill) {
   if ($cur_prof != $skill['prof']) {
      if (!$first_prof) {
         echo "[/build]\n";
      }
      else {
         $first_prof = false;
      }
      echo "[build prof={$skill['profession']} name=\"{$skill['profession']}\"]";
      $cur_prof = $skill['prof'];
      $cur_attr = $skill['attr'];
   }
   else if ($cur_attr != $skill['attr']) {
      echo '-';
      $cur_attr = $skill['attr'];
   }
   echo '['.$skill['name'].']';
   echo '['.preg_replace('/\s*\(pv[ep]\)/i', '', $skill['name']) . ' (PvE)'.']';
}
echo "[/build]\n";
?></pre>